package com.aj.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.aj.activity.view.GestureContentView;
import com.aj.activity.view.GestureDrawl.GestureCallBack;
import com.aj.sharepreferences.LoveHomeSharedPreferences;
import com.aj.utils.Contants;

public class GesturePasswordActivity extends BaseActivity {

	private static final String TAG = GesturePasswordActivity.class.getName();

	private FrameLayout body_layout;
	private TextView alertmessage_text;
	private GestureContentView content;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_gesture);
		initView();
	}

	private void initView() {
		setActionBarTitle(R.string.safe_update_gesture_password_unlock_text);
		body_layout = (FrameLayout) findViewById(R.id.body_layout);
		alertmessage_text = (TextView) findViewById(R.id.alertmessage_text);
		alertmessage_text
				.setText(getString(R.string.safe_update_gesture_password_popromt_text));
		content = new GestureContentView(this, LoveHomeSharedPreferences
				.getGesturePassowrd().trim(), new GestureCallBack() {
			@Override
			public void checkedSuccess() {
				Intent intent = new Intent(Contants.GESTURE_ACTIVITY_ACTION);
				startActivity(intent);
				finish();
			}

			@Override
			public void checkedFail() {
				Toast.makeText(
						GesturePasswordActivity.this,
						getString(R.string.safe_update_gesture_password_error_text),
						Toast.LENGTH_LONG).show();
			}
		});
		content.setParentView(body_layout);
	}
}
